package oop.core.area;
import oop.core.entity.Entity;


/**
 * This is the AreaEffect for setting effects that causes an entity to level up
 */
public class LevelUpAreaEffect extends AreaEffect {
	
	private int numLevelsGained = 1;
	
	/**
	 * Constructor that changes the number of levels gained when this goes off, default is 1.
	 * @param isOn If the AreaEffect is active
	 * @param delay How long between each time the AreaEffect takes effect
	 * @param levels The number of levels that the entity should gain
	 */
	public LevelUpAreaEffect(boolean isOn, long delay, int numLevelsGained) {
		super(isOn, delay);
		this.numLevelsGained = numLevelsGained;
	}
	
	/**
	 * Levels up the entity
	 * @param ent The entity being affected by the areaEffect
	 * @return Returns if the effect happened (based on isOn)
	 */
	public boolean doEffect(Entity ent)
	{
		if(isOn)
		{
			ent.doLevelUp(numLevelsGained);
			isOn = false;
			return true;
		} else
		{
			return false;
		}
	}

	
}